﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Demos.DesignPatterns._14_解释器模式
{
    /// <summary>
    /// 终结符表达式- 变量表达式
    /// </summary>
    public class VariableExpression:IExpression
    {
        private string _name;

        public VariableExpression(string name)
        {
            _name = name;
        }

        public bool Interpret(Dictionary<string, bool> context)
        {
            return context[_name];
        }
    }
}
